package cn.wizzer.app.crown.modules.models;

import cn.wizzer.app.crown.modules.models.enums.MatchTypeEnum;
import cn.wizzer.framework.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import org.nutz.integration.json4excel.annotation.J4EIgnore;

import java.math.BigDecimal;

/**
 * 观点
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Table("crown_view_point")
@TableIndexes({@Index(name = "INDEX_CT_AT", fields = {"ctAt"}, unique = false),
        @Index(name = "unique_no", fields = {"no"}, unique = true),
        @Index(name = "index_status", fields = {"status"}, unique = false)})
public class CrownViewPoint extends BaseModel {
    @Column
    @Name
    @Comment("ID")
    @J4EIgnore
    @ColDefine(type = ColType.VARCHAR, width = 32)
    @PrevInsert(uu32 = true)
    private String id;

    @Column
    @Comment()
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String userId;

    @Column
    @Comment("赛事Id")
    @ColDefine(type = ColType.VARCHAR,width = 64)
    private String matchId;

    @Column
    @Comment("标题")
    @ColDefine(type = ColType.VARCHAR,width = 64)
    private String title;

    @Column
    @Comment("概述")
    @ColDefine(type = ColType.TEXT)
    private String sketch;

    @Column
    @Comment("内容")
    @ColDefine(type = ColType.TEXT)
    private String content;

    @Column
    @Comment("赔率")
    @ColDefine(type = ColType.FLOAT, width = 16, precision = 6)
    private BigDecimal odds;

    @Column
    @Comment("比赛类型")
    @ColDefine(type = ColType.VARCHAR)
    private MatchTypeEnum matchType;
    @Column
    @Comment("玩法具体项{simplexJson}")
    @ColDefine(type = ColType.TEXT)
    private String selectedOption;

    @Column
    @Comment("页面展示比分内容（盘口快照")
    @ColDefine(type = ColType.TEXT)
    private String showBets;

    @Column
    @Comment("价格//如果需要修改价格则在订单中另存防止退款出现问题")
    @ColDefine(type = ColType.FLOAT, width = 16, precision = 6)
    private BigDecimal price;

    @Column
    @Comment("创建时间")
    @PrevInsert(els = @EL("$me.now()"))
    private Long ctAt;

    @Column
    @Comment("-1未中，0待，1中")
    @ColDefine(type = ColType.INT,width = 1)
    private Integer result;

    @Column
    @Comment("不中退款")
    @ColDefine(type = ColType.BOOLEAN)
    @Default("0")
    private Boolean refundable;

    @Column
    @Comment("观点单号")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String no;

    @Column
    @Comment("状态(FAIL、不通过,WAIT、待审核，PASS、通过，UP、上架，DOWN、下架)")
    @ColDefine(type = ColType.VARCHAR, width = 16)
    @Default("WAIT")
    private String status;

    @Column
    @Comment("审核意见（备注）")
    @ColDefine(type = ColType.VARCHAR, width = 64)
    private String remark;

}
